<%@ page import="cn.school.service.AdminService" %>
<%@ page import="cn.school.entity.Admin" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: ghost
  Date: 2019/12/8
  Time: 19:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    String username = request.getParameter("username");
    String password = request.getParameter("password");
    AdminService as = new AdminService();
    List<Admin> list = as.findAll();
    boolean flag = false;
    for(Admin ad : list){
        if(username.equals(ad.getUsername())&&password.equals(ad.getPassword())){
            session.setAttribute("username",username);
            session.setAttribute("password",password);
            flag = true;
        }
    }
    if(!flag){
        session.setAttribute("flag","账号密码不匹配！！！");
    }
    response.sendRedirect("login.jsp");
%>
</body>
</html>
